/**
 * 挂载到需要多语言图片的节点
 *  */
cc.Class({
    extends: cc.Component,

    properties: {
        // type需要和Language.js中的文案对应
        type:  cc.String 
    },
    onLoad() {
        let sp = this.node.getComponent(cc.Sprite);
        if (this.type != undefined && this.type != null && this.type!='') {
            this.updatelanguage(sp,this.type);   
        }
    },
    updatelanguage(sp,type) {
        let pic_url;
        if (cc.sys.language != cc.sys.LANGUAGE_CHINESE) {
            pic_url = MyLanguageSprite[type].en;
        }else {
            pic_url = MyLanguageSprite[type].zh;
        }
        cc.resources.load(pic_url, cc.SpriteFrame, function (err, spriteFrame) {
            sp.spriteFrame = spriteFrame;
        });
    }
});

